
parser grammar GameParser;

options {
  language = Java;
  tokenVocab = GameLexer;
  output = AST;
}

@header {
package org.moflon.moca.game.parser; 
}

main: gameName board figures-> ^(GAME gameName board figures);

gameName: GAME_NAME QUOTED_STRING -> QUOTED_STRING;

board: BOARD width height -> ^(BOARD width height); 
width: WIDTH COLON NUMBER -> ^(WIDTH NUMBER);
height: HEIGHT COLON NUMBER -> ^(HEIGHT NUMBER);

figures: figure+ -> ^(FIGURES figure+);

figure: FIGURE piece rule-> ^(FIGURE piece rule);
piece: QUOTED_STRING;

rule: RULE OPEN set* CLOSE -> ^(RULE set*);
set: direction+ SEPERATOR -> ^(SET direction+);
direction: (GOUP | GODOWN | GOLEFT | GORIGHT | DESTROY | EMPTY); 
 
   